Imports System.ComponentModel
Imports System.Web.UI

<ToolboxData("<{0}:AutoPostBack runat=server></{0}:AutoPostBack>")> Public Class AutoPostBack
    Inherits System.Web.UI.WebControls.WebControl
    Private _AutoPostBack As Boolean

    Protected Overrides ReadOnly Property TagName() As String
        Get
            Return "Input"
        End Get
    End Property
    
    Protected Overrides Sub CreateChildControls()
        Dim txt As New System.Web.UI.WebControls.TextBox
        Dim strPostBackCode As String
        Dim pbo As PostBackOptions

        txt.ID = "MyTextBox"
        Me.Controls.Add(txt)
        pbo = New PostBackOptions(Me)
        'pbo.ActionUrl = ""
        pbo.Argument = "5"
        'pbo.AutoPostBack = True
        pbo.ClientSubmit = False
        'pbo.RequiresJavaScriptProtocol = True
        pbo.TrackFocus = True

        pbo.PerformValidation = True
        pbo.ValidationGroup = "UpdateItems"

        strPostBackCode = Me.Page.ClientScript.GetPostBackEventReference(pbo)
        txt.Attributes("onBlur") = strPostBackCode
    End Sub

    Public Property AutoPostBack() As Boolean
        Get
            Return _AutoPostBack
        End Get
        Set(ByVal value As Boolean)
            _AutoPostBack = value
        End Set
    End Property
End Class
